from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict

class ClickHouseConfig(BaseSettings):

    CLICKHOUSE_HOST: str = "192.168.101.3"
    CLICKHOUSE_PORT: int = 18123
    CLICKHOUSE_USER: str = "default"
    CLICKHOUSE_PASSWORD: str = "123456"
    CLICKHOUSE_DB: str = "ods"
    CLICKHOUSE_POOL_SIZE: int = 20

    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore"
    )
    def __str__(self):
        return f"clickHouseConfig[host:{self.CLICKHOUSE_HOST},port:{self.CLICKHOUSE_PORT},user:{self.CLICKHOUSE_USER},password:{self.CLICKHOUSE_PASSWORD},database:{self.CLICKHOUSE_DB},pool_size:{self.CLICKHOUSE_POOL_SIZE}]"

# 使用示例
click_config = ClickHouseConfig()